FROM node:latest  as builder
WORKDIR /usr/src/app/
USER root
COPY package.json ./
COPY ./ ./
RUN npm config set registry https://registry.npm.taobao.org && npm install && npm run build

FROM nginx:latest
COPY ./docker/nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=builder /usr/src/app/dist  /usr/share/nginx/html/
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]